/*************************************************************************
 * @file: face.h
 * @date: 01/04/2012
 * TOPOL v1_0 - (c)copyright 2012 TEC/UFF
 *************************************************************************
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 ************************************************************************/

#ifndef _FACE
#define _FACE

// includes
//----------

// forward declarations
//----------------------
class Solid;
class Loop;
class ISurface;


/*!
 * CLASS
 * Face
 * 
 * This class implements the requirement for the topological entity named
 * Face and sets all the necessary adjacency informations
 * 
 * @author Andre Pereira (andremaues@id.uff.br)
 * @version 1.0.0
 * @see Solid
 * @see Loop
 */
class Face
{

public:

  ////////////////////////////////////////////////
  ///  Constructor and Destructor Declaration  ///
  ////////////////////////////////////////////////

  /**
   * @brief Constructs a face and attaches it into a given solid object
   * @param _s is a solid object
   */
	Face( Solid* _s );
  ~Face();

  ////////////////////////////////////
  ///  PUBLIC Methods Declaration  ///
  ////////////////////////////////////

  /**
   * @brief Gets the face identity
   * @return size_t with the face identity
   */
	size_t getFaceno();

  /**
   * @brief Gets the previous face
   * @return Face* pointer to the previous face object
   */
	Face* getPrevFace();

  /**
   * @brief Gets the next face
   * @return Face* pointer to the next face object
   */
  Face* getNextf();

  /**
   * @brief Gets the solid whose this face belongs
   * @return Solid* pointer to the solid
   */
	Solid* getSolid();

  /**
   * @brief Gets the external loop
   * @return Loop* pointer to the external loop
   */
	Loop* getLoopOut();

  /**
   * @brief Gets the face's loops
   * @return Loop* pointer to the list of loops
   */
  Loop* getFloops();

  /**
   * @brief Gets the geometric data associated to the face
   */
	ISurface* getSurface();

  /**
   * @brief Verifies if the face is selected or not
   * @return bool with selection status (true: selected, false: not selected)
   */
  bool isSelected();

  /**
   * @brief Sets an identity for the face
   * @param _f the face identity
   */
	void setFaceno( size_t _f );

  /**
   * @brief Sets the external Loop of the Face
   * @param _loop the external loop
   */
  void setFlout( Loop* _loop );

  /**
   * @brief Sets a Loop of the Face
   * @param _loop is a new face loop
   */
  void setLoop( Loop* _loop );	

  /**
   * @brief Sets if the face is selected or not
   * @param _select is used to define the selection status (true: selected, false: not selected)
   */
  void setSelection( bool _select );

  /**
   * @brief Sets the geometric data associated to the face
   */
	void setSurface();


private:

  ////////////////////////////////
  ///  Attributes Declaration  ///
  ////////////////////////////////

  /** @brief Identification of the face, i.e., the face identity */
	size_t m_faceno;

  /** @brief Pointer to the previous face */
	Face* m_prevf;

  /** @brief Pointer to the next face */
	Face* m_nextf;	

  /** @brief Back pointer to solid */
	Solid* m_fsolid;

  /** @brief Pointer to the external loop */
	Loop* m_flout;

  /** @brief Pointer to the list of loops */
  Loop* m_floops;

  /** @brief Geometric description of the face */
  ISurface* m_surface;

  /** @brief Flag to identify if the face is selected or not */
  bool m_isSelected;		

  // TODO: 01/04/2012
  // add a bounding box

};

#endif
